/**
 * Copyright (c) 2018 人人开源 All rights reserved.
 * <p>
 * https://www.renren.io
 * <p>
 * 版权所有，侵权必究！
 */

package io.renren.controller;


import io.renren.annotation.Login;
import io.renren.common.utils.Result;
import io.renren.common.validator.ValidatorUtils;
import io.renren.dto.LoginDTO;
import io.renren.service.TokenService;
import io.renren.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Map;

/**
 * 登录接口
 *
 * @author Mark sunlightcs@gmail.com
 */
@RestController
@RequestMapping("/api")
@Api(tags = "登录接口")
@AllArgsConstructor
public class ApiLoginController {
    private final UserService userService;
    private final TokenService tokenService;


    @PostMapping("wxLogin")
    @ApiOperation("微信登录")
    public Result<Map<String, Object>> wxLogin(String code) {
        //用户登录
        Map<String, Object> map = userService.wxLogin(code);
        return new Result().ok(map);
    }


    @PostMapping("aliLogin")
    @ApiOperation("支付宝登录")
    public Result<Map<String, Object>> aliLogin(String code) {
        //用户登录
        Map<String, Object> map = userService.aliLogin(code);
        return new Result().ok(map);
    }

}